@extends("layouts.backend.webadmin")
@section('page-header')
<h1>
    <small>config</small>
</h1>
@endsection

@section('content')
<link rel="stylesheet" href="{{env('APP_ROOT')}}/assets/select2/css/select2.min.css">
<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-xs-12">

            <div class="box">

                <div class="box-body">
                    @if($errors->any())
                        <ul class="alert alert-danger">
                            @foreach($errors->all() as $error)
                                <li>{{ $error }}</li>
                            @endforeach
                        </ul>
                    @endif
                    <form method="post" action="{{ URL::route('admin.projectmanage.addrow') }}">
                        <div class="form-group">
                            <label for="name">项目名称</label>

                            <input value="{{old('name')}}" name="name" type="text" class="form-control" placeholder="项目名称">
                        </div>
                        <div class="form-group">
                            <label for="app_id">目标应用</label>
                            <select class="form-control select2" aria-hidden="true" name="app_id">
                                <option>--目标应用--</option>
                                @foreach($apps as $app)
                                    <option @if(old('app_id')==$app->id) selected @endif value="{{$app->id}}">{{$app->name}}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="pcp">责任人</label>
                            <select class="form-control select2" multiple aria-hidden="true" name="pcp[]">
                            <option>--责任人--</option>
                            @foreach($pcp as $pc)
                                    @if(!empty(old('pcp')))
                                    @foreach(old('pcp') as $pcId)
                                    <option @if($pcId==$pc->id) selected @endif  value="{{$pc->id}}">{{$pc->name}}</option>
                                    @endforeach
                                        @else
                                        <option value="{{$pc->id}}">{{$pc->name}}</option>
                                    @endif
                            @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="started_at">开始时间</label>

                            <input value="{{old('started_at')}}" name="started_at" type="text" class="form-control data-picker" placeholder="Started_at">
                        </div>
                        <div class="form-group">
                            <label for="ended_at">结束时间</label>

                            <input value="{{old('ended_at')}}" name="ended_at" type="text" class="form-control data-picker" placeholder="Ended_at">
                        </div>
                        <div class="form-group">
                            <label for="status">状态</label>
                            <select class="form-control" id="status" name="status" disabled>
                                @foreach($statusArr as $id => $status)
                                <option value="{{$id}}" @if($id==1) selected @endif>{{$status}}</option>
                                @endforeach
                            </select>
                            <input type="hidden" name="status" value="1">
                        </div>
                        {!! csrf_field() !!}
                        <button type="submit" class="btn btn-primary">提交</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>
@stop
@section('javascript-end')
<script src="{{env('APP_ROOT')}}/assets/select2/js/select2.min.js"></script>
<script>
    $(function () {
        console.log('welcome to ck page.');
        //日历控件
        $('.data-picker').datepicker({
            autoclose: true
        });
        //下拉筛选
        $('.select2').select2({"border-radius":'0px'});
    });
</script>
@endsection
